package com.hzit.entity;

import com.hzit.validator.AddGroup;
import com.hzit.validator.OrderValidator;
import com.hzit.validator.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Null;

/**
 * 类名：
 * 作者：WF
 * 功能：规格选项表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "tb_specification_option")
public class SpecificationOption {

	@Null(groups = AddGroup.class,message = "添加规格选项时不能指定主键！")
	@Id
	private Long id;
	@NotBlank(message = "规格选项名字不能为空！",groups = {AddGroup.class, UpdateGroup.class})
	private String optionName;
	private Long specId;

	// 自定义一个校验规则
	@OrderValidator(message = "顺序号必须在1-10之间！",groups = {AddGroup.class, UpdateGroup.class})
	private Integer orders;


}
